<?php
declare (strict_types = 1);

namespace app\api\model\v1;

use think\Model;

/**
 * @mixin \think\Model
 */
class AuditExam extends AppModel
{


    const ONE_STATUS = 1; //待审核
    const TWO_STATUS = 2; //已审核
    const THREE_STATUS = 3; //退回


    //
    public function admin(){
        return $this->belongsTo(Admins::class,'audit_admin_id')->field('id,nickname,username');
    }


    public function user(){
        return $this->belongsTo(Users::class,'user_id')->field('id,nickname,username,head_img');
    }


    public function unit(){
        return $this->belongsTo(Unit::class,'unit_id')->field('id,unit_title,attribute');
    }


    public function exam(){
        return $this->belongsTo(Exam::class,'exam_id')->field('id,exam_name,unit_id');
    }

    public function examFile(){
        return $this->hasMany(AuditExamFile::class,'audit_exam_id');
    }
    public function submit(){
        return $this->hasMany(AuditExamFile::class,'audit_exam_id');
    }
    public function unchecked(){
        return $this->hasMany(AuditExamFile::class,'audit_exam_id');
    }

    public function giveBack(){
        return $this->hasOne(GiveBackExam::class,'audit_exam_id');
    }
}
